package com.wiloon.java8x.io.db;

import org.skife.jdbi.v2.DBI;
import org.skife.jdbi.v2.Handle;
import org.skife.jdbi.v2.util.StringMapper;

import javax.sql.DataSource;

/**
 * Created by wiloon on 5/6/17;
 */
public class TTT {
//    public static void main(String[] args) {
//        DataSource ds = JdbcConnectionPool.create("jdbc:h2:mem:test",
//                "username",
//                "password");
//        DBI dbi = new DBI(ds);
//        Handle h = dbi.open();
//        h.execute("create table something (id int primary key, name varchar(100))");
//        h.execute("insert into something (id, name) values (?, ?)", 1, "Brian");
//        String name = h.createQuery("select name from something where id = :id")
//                .bind("id", 1)
//                .map(StringMapper.FIRST)
//                .first();
//
//        assertThat(name, equalTo("Brian"));
//        h.close();
//    }
}
